var vm = new Vue({
    el: '#app',
    data:{
        host,
        username: sessionStorage.username || localStorage.username,
        user_id: sessionStorage.user_id || localStorage.user_id,
        token: sessionStorage.token || localStorage.token,
        news_id:get_query_string("news_id",1),
        news:{},
    },
    mounted: function(){
        this.get_news();

      },
    methods: {
        // 获取新闻分类
        get_news: function () {
            axios.get(this.host + '/news/'+this.news_id+'/', {
                responseType: 'json'
            })
                .then(response => {
                    this.news = response.data[0];
                    console.log(this.news)


                })
                .catch(error => {
                    console.log(error.response.data)
                })
        },
        dateSwitch:function (time) {
           return dateFormat(time);
        },
        // get_newslist: function () {
        //     axios.get(this.host + '/news_list/' + this.cid + '/', {
        //         responseType: 'json'
        //     })
        //         .then(response => {
        //             this.news_list = response.data;
        //         })
        //         .catch(error => {
        //             console.log(error.response.data)
        //         })
        //
        // },


    },

    });
